﻿@using GoodMan.Infrastructure.Entities.Entity;
@using GoodMan.Infrastructure.Entities.Enum;
@using GoodMan.Infrastructure.Entities.Contract;
@using GoodMan.Tool.Framework;
@{
    ViewBag.Title = "订单详情";
    Layout = "~/Areas/WorkSpace/Views/Shared/_CollegeAdminTemplete.cshtml";
    List<OrderDetail> orderDetailList = ViewBag.OrderDetail;
    Order order = ViewBag.Order;
    User userInfo = ViewBag.User == null ? new User() : ViewBag.User;
    Business business = new Business().Find(order.BusinessId.ToString());
    Dormitory dormitory = new Dormitory().Find(order.DormitoryID.ToString());
    int appraise = Convert.ToInt32(order.TotalPrice);
    List<OrderHistory> orderHistoryList = ViewBag.OrderHistory == null ? new List<OrderHistory>() : ViewBag.OrderHistory;
}



<div id="content-header">
    <h1>订单详情</h1>
</div>
<div id="breadcrumb">
	<a href="/Admin/index" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>首页</a>
	<a href="/workspace/Admin/OrdersStatistics" class="tip-bottom">订单管理</a>
	<a href="#" class="current">订单详情</a>
</div>
<div class="container-fluid">
  <div class="row-fluid">
     <div class="span12">
     <div class="widget-box">
			<div class="widget-title">			
				<h5>订单详情</h5>
			</div>
             <!--订单描述信息-->
        <div class="border-gray padding-10" style="width:90%; margin:0px auto">
            <div class="row-fluid">
                <div class="span6">订单号：@order.OrderCode</div>
                <div class="span6">订单状态：@if (order.Status == OrderStatus.Completed)
                                        {
                                    <span class="label label-success">@order.Status.Mapping()</span>
                                        }
                                        else if (order.Status == OrderStatus.WaitForDeliver || order.Status == OrderStatus.Paid)
                                        {
                                    <span class="label label-warning">@order.Status.Mapping()</span>
                                        }
                                        else if (order.Status == OrderStatus.Reserved)
                                        {
                                    <span class="label label-info">@order.Status.Mapping()</span>
                                        }
                                        else
                                        {
                                    <span class="label">@order.Status.Mapping()</span>
                                        }</div>
            </div>

			<div class="row-fluid">
                <div class="span6">购买人：@order.UserName</div>
                <div class="span6">联系电话：@order.Phone</div>
            </div>
			
            <div class="row-fluid">
                <div class="span6">收货人：@order.UserName</div>
                <div class="span6">收货楼栋：@dormitory.Name</div>
            </div>

            <div class="row-fluid">
@{
                            if (order.AreaCode == AreaCode.Integration)
                            {
                            <div class="span6">
                                需要积分： <strong class="red">@appraise</strong>
                            </div>
                            }
                            else
                            {
                            <div class="span6">
                                订单金额： <strong class="red">&yen;@order.TotalPrice</strong>
                            </div>
                            <div class="span6">
                                获得积分：@appraise</div>                     
                            }
                        }
            </div>
            
        </div>
        <!--#订单描述信息-->
        <!--购物车-->
        <table class="table table-bordered data-table" style="width:95%; margin:0px auto">
            <thead>
                <tr>
                    <th>
                        商品名称
                    </th>
                    <th style="width:15%">
                        单价（元）
                    </th>
                    <th style="width:15%">
                        数量
                    </th>
                    <th style="width:30%">
                        交易
                    </th>
                    <th style="width:10%">
                        状态
                    </th>
                   
                </tr>
            </thead>
            <tbody>
                @{
                    if (orderDetailList != null && orderDetailList.Any())
                    {
                        string productUrl = "";
                        foreach (var item in orderDetailList)
                        {
                            if (item.AreaCode == AreaCode.Snack)
                            {
                                productUrl = "/shop/FastFoodDetail?d=" + item.ProductId;
                            }
                            else if (item.AreaCode == AreaCode.Combination)
                            {
                                productUrl = "/shop/PackagesProductsDetail/" + item.ProductId;
                            }
                            else
                            {
                                productUrl = "/shop/ProductItemView/" + item.ProductId;
                            }
                    <tr>
                        <td>
                            <div style="width:180px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;display:block;">
                            <a href="@productUrl" target="_blank">@item.ProductName</a></div>
                        </td>
                        <td>
                                @item.Price 元 
                        </td>
                        <td>
                            @item.Num
                        </td>
                        <td>
                            <small>订单号：@order.OrderCode<br />
                                成交：@order.OrderDate.ToString("yyyy-MM-dd HH:ss")</small>
                        </td>
                        <td>
                             @{if (order.Status == OrderStatus.Completed)
                               {
                                    <span class="label label-success">@order.Status.Mapping()</span>
                               }
                               else if (order.Status == OrderStatus.WaitForDeliver || order.Status == OrderStatus.Paid)
                               {
                                    <span class="label label-warning">@order.Status.Mapping()</span>
                               }
                               else if (order.Status == OrderStatus.Reserved)
                               {
                                    <span class="label label-info">@order.Status.Mapping()</span>
                               }
                               else
                               {
                                    <span class="label">@order.Status.Mapping()</span>
                               }
                                }
                        </td>
                    </tr>
                    
                    
                               if (!string.IsNullOrEmpty(item.Catering))
                               {
                                   CateringSet catering = item.Catering.ToObject<CateringSet>(); 
                     <tr><td colspan="5">
                      @{
                    
                                   foreach (var cItem in catering.cateringList)
                                   {
                                <div>
                                    @cItem.caterCategory&nbsp &nbsp;&nbsp;</div>
                                <div>
                                    @{
                                       foreach (var ciItem in cItem.cateringInfoList)
                                       {
                                            <span>菜名:<b><font color="#333399">@ciItem.caterName</font></b>&nbsp;&nbsp;价格:&yen;@ciItem.caterPrice&nbsp;
                                                &nbsp;份数:<font color="#ff0000">@ciItem.caterNumber</font></span>
                                       }
                                    }
                                </div>
                                   }
                    
                            }
                     
                     </td></tr>
                               }
                        }

                    }
                }
            </tbody>            
        </table>
        <br />
        <!--#购物车-->
		<table class="table table-bordered data-table" style="width:95%; margin:0px auto">
            <thead>
            <tr>
                <th style="width:30%"></th>
                <th style="width:30%">时间</th>
                <th>备注</th>
            </tr>
            </thead>
            <tbody>
            @{
                if (orderHistoryList != null && orderHistoryList.Count != 0)
                {
                    foreach (var item in orderHistoryList)
                    {
                    
            <tr>
                <td>
                    @item.CurrentStatue.Mapping()
                </td>
                <td>@item.CreateTime</td>
                <td>@item.Remark</td>
            </tr>
                    }
                }
                else
                {
                <tr><td colspan="3">没有相关信息！</td></tr>
                }
                }
            </tbody>
        </table>
        <br/>
         <div style="width:100px; margin:0px auto;" >
                            <a href="javascript:history.go(-1);"  class="btn btn-primary btn-mini">
                                返回</a></div><br />
        </div>
       
     </div>
  </div>
</div>

@section tail{
<script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
<script type="text/javascript" src="/Scripts/jquery.metadata.js"></script>
<script type="text/javascript" src="/Scripts/messages_cn.js"></script>
<script type="text/javascript" src="/Scripts/plug.js"></script>

<script type="text/javascript">
    $(function () {
        $('#likOrder').addClass('open');

        $('#likOrder').addClass('active');
    });
</script>

}



